<php> $cMod = strtoupper($mod);</php>
<div class="comments"
     data-del-url="{:tox_addons_url('LocalComment/Index/deleteComment', array('count_model'=>$count_model,'count_field'=>$count_field))}">
    <header>
        <h3><i class="icon-comments icon-border-circle"></i> <span class="total_count">{$total_count}</span>条评论</h3>
    </header>
    <footer>

        <div class="reply-form">
            <php>if(is_login()){</php>
            <a href="{$myInfo.space_url}" class="avatar"><img src="{$myInfo.avatar32}" ucard="{$myInfo.uid}"
                                                              class="avatar-img"/></a>
            <php>}elseif($can_guest){</php>
            <a href="javascript:" title="游客" class="avatar"><i class="icon-user icon-border icon-2x icon-muted"
                                                               style="color:#999;width: 32px;text-align:center;display:block;"></i></a>
            <php>}</php>

            <php>if($can_guest || is_login()){</php>
            <div class="form">
                <div class="form-group">
                    <textarea class="form-control new-comment-text " id="local_comment_textarea" rows="2" placeholder=""></textarea>
                </div>
                <div class="pull-right">
                    <a href="javascript:" data-role="send_local_comment" data-path="{$path}"  data-this-url="{$this_url}"  data-extra="{$extra}"
                       data-url="{:tox_addons_url('LocalComment/Index/addComment', array('uid'=>$uid,'count_model'=>$count_model,'count_field'=>$count_field))}"
                       class="btn btn-primary">
                        <i class="icon-comment-alt"></i> 发表评论
                    </a>
                </div>
            </div>
            <php>}</php>
        </div>


    </footer>

    <section class="comments-list clearfix">
        <volist name="list" id="comment">
            <include file="./Addons/LocalComment/_comment.html"/>
        </volist>
        <div class="pager">
            {$pageHtml}
        </div>
    </section>
</div>

<script>
    var local_comment_order = "{:modC($cMod.'_LOCAL_COMMENT_ORDER',0)}";
    var local_comment_count = "{:modC($cMod.'_LOCAL_COMMENT_COUNT',10)}";
    var local_comment_page = function (app, mod, row_id, page) {
        $.post("{:tox_addons_url('LocalComment/Index/getCommentList')}", {app: app, mod: mod, row_id: row_id, page: page}, function (res) {
            $('.comments').find('section').html(res.html);
            bind_local_comment();
        }, 'json');
    }


    $(function () {
        $('#local_comment_textarea').keypress(function (e) {
            if (e.ctrlKey && e.which == 13 || e.which == 10) {
                $(this).closest('.form').find("[data-role='send_local_comment']").click();
            }
        });
    })


</script>
<script type="text/javascript" src="{:getRootUrl()}Addons/LocalComment/_static/js/comment.js"></script>
